package com.tanhua.dubbo.server.controller;

import com.tanhua.common.utils.Cache;
import com.tanhua.dubbo.server.service.TodayBestService;
import com.tanhua.dubbo.server.vo.PageResult;
import com.tanhua.dubbo.server.vo.RecommendUserQueryParam;
import com.tanhua.dubbo.server.vo.TodayBest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @ClassName: TodayBestController
 * @Author:王晨晗
 * @Description: 佳人推荐功能
 * @Date: 2021/12/28/17:14
 */
@RestController
@RequestMapping("tanhua")
public class TodayBestController {
    @Autowired
    private TodayBestService todayBestService;

    /**
     * @description 今日佳人接口功能
     * @updateTime 2021/12/28 20:17
     * @return: org.springframework.http.ResponseEntity
     */
    @GetMapping("todayBest")
    public ResponseEntity todayBest(){
        //调用service方法,查询今日佳人
        TodayBest todayBest = todayBestService.queryTodayBest();
        //返回结果信息
        return ResponseEntity.ok(todayBest);
    }

    /**
     * @description 推荐列表
     * @param params : 请求参数
     * @updateTime 2021/12/28 20:18
     * @return: org.springframework.http.ResponseEntity
     */
    @GetMapping("recommendation")
    @Cache(time = "30")
    public ResponseEntity recommendation(RecommendUserQueryParam params){
        //调用service方法,查询推荐佳人列表
        PageResult pageResult = todayBestService.queryRecommendation(params);
        return ResponseEntity.ok(pageResult);
    }
}
